<?php /* VoteItUp skin file */

// Globals issue http://expressionengine.com/knowledge_base/article/my_php_functions_cannot_reference_global_php_variables/ 

global $skinname, $support_images, $support_sinks;
$skinname = 'Orange Glass'; //No effect yet, but its good to state
$support_sinks = 'false'; //Only warns the user
$support_images = 'false'; //Only warns the user

function SkinInfo($item) {
global $support_sinks, $support_images;
switch($item) {
case 'supportsinks':
return $support_sinks;
break;
case 'supportimages':
return $support_images;
break;
default:
return 'nothing';
break;

}
}

function LoadVote() {
global $user_ID, $guest_votes, $vote_text, $use_votetext, $allow_sinks;
 ?>
<?php if (function_exists('VoteItUp_options')) { ?>
	<?php if ($user_ID == '') { 
if ($guest_votes == 'true') {
	if(!GuestVoted(get_the_ID(),md5($_SERVER['REMOTE_ADDR']))) { ?>
<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php the_ID(); ?>">
	<div class="post_votecount" id="votes<?php the_ID(); ?>"><?php echo GetVotes(get_the_ID()); ?></div>
 	<div id="voteid<?php the_ID(); ?>" class="post_votebuttoncontainer"><a href="javascript:vote_nticker(<?php the_ID(); ?>,<?php the_ID() ?>,0,'<?php echo VoteItUp_ExtPath(); ?>');" class="post_votebutton"><?php echo $vote_text; ?></a></div>
</div></div>
	<?php } else { ?>
<div class="post_postvote"><div class="post_votewidget_closed" id="votewidget<?php the_ID(); ?>">
	<div class="post_votecount" id="votes<?php the_ID(); ?>"><?php echo GetVotes(get_the_ID()); ?></div>
</div></div>
	<?php }
}
} else { ?>
	<?php if(!UserVoted(get_the_ID(),$user_ID)) { ?>
<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php the_ID(); ?>">
	<div class="post_votecount" id="votes<?php the_ID(); ?>"><?php echo GetVotes(get_the_ID()); ?></div>
 	<div id="voteid<?php the_ID(); ?>" class="post_votebuttoncontainer"><a href="javascript:vote_nticker(<?php the_ID(); ?>,<?php the_ID() ?>,<?php echo $user_ID; ?>,'<?php echo VoteItUp_ExtPath(); ?>');" class="post_votebutton"><?php echo $vote_text; ?></a></div>
</div></div>
	<?php } else { ?>
<div class="post_postvote"><div class="post_votewidget_closed" id="votewidget<?php the_ID(); ?>">
	<div class="post_votecount" id="votes<?php the_ID(); ?>"><?php echo GetVotes(get_the_ID()); ?></div>
</div></div>
	<?php } } ?>

<?php }
}

function LoadVoteWidget() {

	$a = SortVotes();
	//Before
?>
<div class="votewidget_skin">
<?php
	$rows = 0;

	for ($i = 0; $i < count($a[0]); $i++) {
		if ($rows < 10) {
			if ($a[0][$i][0] != '') {
				$rows++;
				$postdat = get_post($a[0][$i][0]);
				echo '<div class="votelistind"><div class="votemicro">'.$a[1][$i][0].'</div><span class="votemicrotext"><a href="'.$postdat->guid.'" title="'.htmlentities($postdat->post_title).'">'.htmlentities($postdat->post_title).'</a></span></div>';

			}
		}
	}
	
?>
</div>

<?php

}

?>